# Go parameters
GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GODOWNLOAD=$(GOCMD) mod download

download:
	$(GODOWNLOAD)

config:
	rm target/bilinaccount.toml
	cp bilinaccount.toml target/bilinaccount.toml

build:
	mkdir target
	#cp bilinaccount.toml target/bilinaccount.toml
	$(GOBUILD) -o target/bilinaccount ./main.go

clean:
	rm -rf target

dev:
	go run main.go account -c=bilinaccount.toml 

run:
    # 启动应用
	target/bilinaccount account -c=target/bilinaccount.toml

run2:
    # 启动应用
	nohup target/bilinaccount account -c=target/bilinaccount.toml 2>&1 > target/bilinaccount.log &


stop:
	pkill -f target/bilinaccount account


proto-old:
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/server ./api/proto/server/*.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/bilin_open.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/gsms.proto
	sed -i "" -e "s/,omitempty//g" ./api/pb/*/*.go

proto:
	protoc -I=. --gofast_out=plugins=grpc:./api/pb/server ./api/proto/server/*.proto
	protoc -I=. --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/bilin_open.proto
	protoc -I=. --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/gsms.proto
	sed -i "" -e "s/,omitempty//g" ./api/pb/*/*.go
